<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>


    const pathArr = "120.581539,31.301371,120.579436,31.293597,120.590422,31.298878,120.576775,31.298621,120.58583,31.296091"
    const temp = pathArr ? pathArr.split(',') : []

    let path = []
    for (let i = 0, len = temp.length - 1; i < len; i += 2) {
        path.push([temp[i], temp[i + 1]])
    }

    console.log(path)
</script>
</body>
</html>
